package ru.ganyaev.external_process;

import java.util.List;

class BasicExternalProcessResult extends ExternalProcessResult {
    private Integer exitCode;
    private List<String> stdOutput;
    private List<String> stdError;

    BasicExternalProcessResult(Integer exitCode, List<String> stdOutput,
            List<String> stdError) {
        this.exitCode = exitCode;
        this.stdOutput = stdOutput;
        this.stdError = stdError;
    }

    @Override
    public List<String> getStdOut() {
        return this.stdOutput;
    }

    @Override
    public List<String> getStdError() {
        return this.stdError;
    }

    @Override
    public Integer getExitCode() {
        return this.exitCode;
    }

    @Override
    public Boolean isValid() {
        if (exitCode == 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return "BasicExternalProcessResult [exitCode=" + exitCode
                + ", stdOutput=" + stdOutput + ", stdError=" + stdError + "]";
    }
}
